package com.bocloud.cmp.web.controller.resource;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bocloud.common.enums.BoCloudMethod;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BsmResult;
import com.bocloud.registry.http.core.ServiceFactory;
import com.bocloud.registry.http.model.RemoteService;

@RestController
@RequestMapping("/statistic")
public class StatisticController {

	private final String BASE_SERVICE = "/statistic";
	private static final BoCloudService SERVICE = BoCloudService.Cmp;
	@Autowired
	private ServiceFactory serviceFactory;

	/**
	 * 统计
	 * 
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/computer", method = { RequestMethod.GET })
	public BsmResult computer(HttpServletRequest request) {
		String url = BASE_SERVICE + "/computer";
		RemoteService service = serviceFactory.safeBuild(SERVICE, url, BoCloudMethod.SUBOBJ, null, null, request);
		return service.invoke();
	}

}
